﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using University.Workshop.Model;
using University.Workshop.DataAccess;

[assembly: CLSCompliant(true)]
namespace University.Workshop.Business
{
    public static class CashManagementManager
    {
        public static CashManagement RegisterNewPayment(
            string doctorId,
            string patientId,
            string concept,
            string date,
            string amount,
            string paymentMethod,
            //string paymentState,
            string discount)
        {
            if (string.IsNullOrEmpty(doctorId) ||
                string.IsNullOrEmpty(patientId) ||
                string.IsNullOrEmpty(concept) ||
                string.IsNullOrEmpty(date) ||
                string.IsNullOrEmpty(amount) ||
                string.IsNullOrEmpty(paymentMethod))
            {
                throw new DataValidationException("Todos los campos son requeridos para el registro.");
            }

            CashManagement newPayment = new CashManagement
            {
                DoctorId = doctorId,
                PatientId = patientId,
                Concept = concept,
                Date = date,
                Amount = amount,
                PaymentMethod = paymentMethod,
                //PaymentState = paymentState,
                Discount = discount
            };
            CashManagementDataAccess.InsertPayment(newPayment);
            return newPayment;
        }
    }
}
